/**
 * @计算最小公倍数
 *
 * @author	 wangshikun <wangshikun2010@gmail.com>
 * @copyright	(c) 2012 wangshikun <wangshikun2010@gmail.com>
 * @license	http://www.opensource.org/licenses/mit-license.php The MIT License
 * @package	default
 * @subpackage	default
 */

#include <stdio.h>
#include <cs50.h>

int x, y;

void enternumber(void);
int lcm(int m, int n);

int main(int argc, char *argv[]) {
	int s;

	enternumber();
	
	s = lcm(x, y);
	printf("%d\n", s);
}

void enternumber(void) {

	do {
		printf("please enter the first number: ");
		scanf("%d", &x);
	} while (x <= 0);

	do {
		printf("please enter the second number: ");
		scanf("%d", &y);
	} while (y <= 0);
} 

int lcm(int m, int n) {
	int s;

	s = m * n;

	if(m < n) {
		int t = m;
		m = n;
		n = t;
	}

	while (n != 0) {
		int temp = m % n;
		m = n;
		n = temp;
	}
	
	s = s / m;

	return s;
}
